import json
import requests

def get_qianfan_access_token(app_key, secret_key):
    """
    使用 AK，SK 生成鉴权签名（Access Token）
    :return: access_token，或是None(如果错误)
    """
    print(app_key)
    url = f"https://aip.baidubce.com/oauth/2.0/token?client_id={app_key}&client_secret={secret_key}&grant_type=client_credentials"
    payload = json.dumps("")
    headers = {
        'Content-Type': 'application/json',
        'Accept': 'application/json'
    }
    response = requests.request("POST", url, headers=headers, data=payload)
    print(response.text)
    token = response.json().get('access_token')
    print(token)
    return token
